{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5e185c99",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4c055a7d",
   "metadata": {},
   "source": [
    "# Settings\n",
    "\n",
    "## Language Selection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "20790352",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[\n",
      "    {\n",
      "        \"label\": \"Albanian\",\n",
      "        \"value\": \"sq\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Arabic\",\n",
      "        \"value\": \"ar\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Basque\",\n",
      "        \"value\": \"eu\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Bokmål\",\n",
      "        \"value\": \"nb\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Bulgarian\",\n",
      "        \"value\": \"bg\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Catalan\",\n",
      "        \"value\": \"ca\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Chinese\",\n",
      "        \"value\": \"zh\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Croatian\",\n",
      "        \"value\": \"hr\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Czech\",\n",
      "        \"value\": \"cs\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Danish\",\n",
      "        \"value\": \"da\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Dutch\",\n",
      "        \"value\": \"nl\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"English\",\n",
      "        \"value\": \"en\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Estonian\",\n",
      "        \"value\": \"et\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Filipino\",\n",
      "        \"value\": \"tl\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Finnish\",\n",
      "        \"value\": \"fi\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"French\",\n",
      "        \"value\": \"fr\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Galician\",\n",
      "        \"value\": \"gl\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"German\",\n",
      "        \"value\": \"de\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Greek\",\n",
      "        \"value\": \"el\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Hebrew\",\n",
      "        \"value\": \"he\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Hungarian\",\n",
      "        \"value\": \"hu\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Icelandic\",\n",
      "        \"value\": \"is\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Italian\",\n",
      "        \"value\": \"it\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Japanese\",\n",
      "        \"value\": \"ja\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Latin\",\n",
      "        \"value\": \"la\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Lower Sorbian\",\n",
      "        \"value\": \"dsb\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Nynorsk\",\n",
      "        \"value\": \"nn\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Polish\",\n",
      "        \"value\": \"pl\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Portuguese\",\n",
      "        \"value\": \"pt\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Romanian\",\n",
      "        \"value\": \"ro\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Russian\",\n",
      "        \"value\": \"ru\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Serbian\",\n",
      "        \"value\": \"sr\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Slovak\",\n",
      "        \"value\": \"sk\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Slovenian\",\n",
      "        \"value\": \"sl\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Spanish\",\n",
      "        \"value\": \"es\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Swedish\",\n",
      "        \"value\": \"sv\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Turkish\",\n",
      "        \"value\": \"tr\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Ukrainian\",\n",
      "        \"value\": \"uk\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"Vietnamese\",\n",
      "        \"value\": \"vi\"\n",
      "    }\n",
      "]\n"
     ]
    }
   ],
   "source": [
    "# Taken from typst-library/src/text/lang.rs\n",
    "languages = \"\"\"\n",
    "pub const ALBANIAN: Self = Self(*b\"sq \", 2);\n",
    "pub const ARABIC: Self = Self(*b\"ar \", 2);\n",
    "pub const BASQUE: Self = Self(*b\"eu \", 2);\n",
    "pub const BOKMÅL: Self = Self(*b\"nb \", 2);\n",
    "pub const BULGARIAN: Self = Self(*b\"bg \", 2);\n",
    "pub const CATALAN: Self = Self(*b\"ca \", 2);\n",
    "pub const CHINESE: Self = Self(*b\"zh \", 2);\n",
    "pub const CROATIAN: Self = Self(*b\"hr \", 2);\n",
    "pub const CZECH: Self = Self(*b\"cs \", 2);\n",
    "pub const DANISH: Self = Self(*b\"da \", 2);\n",
    "pub const DUTCH: Self = Self(*b\"nl \", 2);\n",
    "pub const ENGLISH: Self = Self(*b\"en \", 2);\n",
    "pub const ESTONIAN: Self = Self(*b\"et \", 2);\n",
    "pub const FILIPINO: Self = Self(*b\"tl \", 2);\n",
    "pub const FINNISH: Self = Self(*b\"fi \", 2);\n",
    "pub const FRENCH: Self = Self(*b\"fr \", 2);\n",
    "pub const GALICIAN: Self = Self(*b\"gl \", 2);\n",
    "pub const GERMAN: Self = Self(*b\"de \", 2);\n",
    "pub const GREEK: Self = Self(*b\"el \", 2);\n",
    "pub const HEBREW: Self = Self(*b\"he \", 2);\n",
    "pub const HUNGARIAN: Self = Self(*b\"hu \", 2);\n",
    "pub const ICELANDIC: Self = Self(*b\"is \", 2);\n",
    "pub const ITALIAN: Self = Self(*b\"it \", 2);\n",
    "pub const JAPANESE: Self = Self(*b\"ja \", 2);\n",
    "pub const LATIN: Self = Self(*b\"la \", 2);\n",
    "pub const LOWER_SORBIAN: Self = Self(*b\"dsb\", 3);\n",
    "pub const NYNORSK: Self = Self(*b\"nn \", 2);\n",
    "pub const POLISH: Self = Self(*b\"pl \", 2);\n",
    "pub const PORTUGUESE: Self = Self(*b\"pt \", 2);\n",
    "pub const ROMANIAN: Self = Self(*b\"ro \", 2);\n",
    "pub const RUSSIAN: Self = Self(*b\"ru \", 2);\n",
    "pub const SERBIAN: Self = Self(*b\"sr \", 2);\n",
    "pub const SLOVAK: Self = Self(*b\"sk \", 2);\n",
    "pub const SLOVENIAN: Self = Self(*b\"sl \", 2);\n",
    "pub const SPANISH: Self = Self(*b\"es \", 2);\n",
    "pub const SWEDISH: Self = Self(*b\"sv \", 2);\n",
    "pub const TURKISH: Self = Self(*b\"tr \", 2);\n",
    "pub const UKRAINIAN: Self = Self(*b\"uk \", 2);\n",
    "pub const VIETNAMESE: Self = Self(*b\"vi \", 2);\n",
    "\"\"\".strip()\n",
    "\n",
    "print(json.dumps([{\"label\": line.split(\":\")[0].split()[-1].title().replace(\"_\", \" \"), \"value\": line.split(\"(\")[-1].split('\"')[1].strip()} for line in languages.split(\"\\n\")], indent=4, ensure_ascii=False))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ac8db963",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[\n",
      "    {\n",
      "        \"label\": \"A0\",\n",
      "        \"value\": \"a0\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A1\",\n",
      "        \"value\": \"a1\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A2\",\n",
      "        \"value\": \"a2\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A3\",\n",
      "        \"value\": \"a3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A4\",\n",
      "        \"value\": \"a4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A5\",\n",
      "        \"value\": \"a5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A6\",\n",
      "        \"value\": \"a6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A7\",\n",
      "        \"value\": \"a7\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A8\",\n",
      "        \"value\": \"a8\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A9\",\n",
      "        \"value\": \"a9\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A10\",\n",
      "        \"value\": \"a10\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"A11\",\n",
      "        \"value\": \"a11\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B1\",\n",
      "        \"value\": \"iso-b1\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B2\",\n",
      "        \"value\": \"iso-b2\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B3\",\n",
      "        \"value\": \"iso-b3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B4\",\n",
      "        \"value\": \"iso-b4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B5\",\n",
      "        \"value\": \"iso-b5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B6\",\n",
      "        \"value\": \"iso-b6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B7\",\n",
      "        \"value\": \"iso-b7\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO B8\",\n",
      "        \"value\": \"iso-b8\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO C3\",\n",
      "        \"value\": \"iso-c3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO C4\",\n",
      "        \"value\": \"iso-c4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO C5\",\n",
      "        \"value\": \"iso-c5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO C6\",\n",
      "        \"value\": \"iso-c6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO C7\",\n",
      "        \"value\": \"iso-c7\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO C8\",\n",
      "        \"value\": \"iso-c8\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"DIN D3\",\n",
      "        \"value\": \"din-d3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"DIN D4\",\n",
      "        \"value\": \"din-d4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"DIN D5\",\n",
      "        \"value\": \"din-d5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"DIN D6\",\n",
      "        \"value\": \"din-d6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"DIN D7\",\n",
      "        \"value\": \"din-d7\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"DIN D8\",\n",
      "        \"value\": \"din-d8\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SIS G5\",\n",
      "        \"value\": \"sis-g5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SIS E5\",\n",
      "        \"value\": \"sis-e5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ANSI A\",\n",
      "        \"value\": \"ansi-a\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ANSI B\",\n",
      "        \"value\": \"ansi-b\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ANSI C\",\n",
      "        \"value\": \"ansi-c\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ANSI D\",\n",
      "        \"value\": \"ansi-d\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ANSI E\",\n",
      "        \"value\": \"ansi-e\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ARCH A\",\n",
      "        \"value\": \"arch-a\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ARCH B\",\n",
      "        \"value\": \"arch-b\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ARCH C\",\n",
      "        \"value\": \"arch-c\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ARCH D\",\n",
      "        \"value\": \"arch-d\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ARCH E1\",\n",
      "        \"value\": \"arch-e1\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ARCH E\",\n",
      "        \"value\": \"arch-e\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B0\",\n",
      "        \"value\": \"jis-b0\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B1\",\n",
      "        \"value\": \"jis-b1\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B2\",\n",
      "        \"value\": \"jis-b2\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B3\",\n",
      "        \"value\": \"jis-b3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B4\",\n",
      "        \"value\": \"jis-b4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B5\",\n",
      "        \"value\": \"jis-b5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B6\",\n",
      "        \"value\": \"jis-b6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B7\",\n",
      "        \"value\": \"jis-b7\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B8\",\n",
      "        \"value\": \"jis-b8\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B9\",\n",
      "        \"value\": \"jis-b9\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B10\",\n",
      "        \"value\": \"jis-b10\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JIS B11\",\n",
      "        \"value\": \"jis-b11\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D0\",\n",
      "        \"value\": \"sac-d0\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D1\",\n",
      "        \"value\": \"sac-d1\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D2\",\n",
      "        \"value\": \"sac-d2\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D3\",\n",
      "        \"value\": \"sac-d3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D4\",\n",
      "        \"value\": \"sac-d4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D5\",\n",
      "        \"value\": \"sac-d5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"SAC D6\",\n",
      "        \"value\": \"sac-d6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO ID 1\",\n",
      "        \"value\": \"iso-id-1\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO ID 2\",\n",
      "        \"value\": \"iso-id-2\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ISO ID 3\",\n",
      "        \"value\": \"iso-id-3\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"ASIA F4\",\n",
      "        \"value\": \"asia-f4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JP SHIROKU BAN 4\",\n",
      "        \"value\": \"jp-shiroku-ban-4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JP SHIROKU BAN 5\",\n",
      "        \"value\": \"jp-shiroku-ban-5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JP SHIROKU BAN 6\",\n",
      "        \"value\": \"jp-shiroku-ban-6\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JP KIKU 4\",\n",
      "        \"value\": \"jp-kiku-4\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JP KIKU 5\",\n",
      "        \"value\": \"jp-kiku-5\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"JP BUSINESS CARD\",\n",
      "        \"value\": \"jp-business-card\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"CN BUSINESS CARD\",\n",
      "        \"value\": \"cn-business-card\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"EU BUSINESS CARD\",\n",
      "        \"value\": \"eu-business-card\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"FR TELLIERE\",\n",
      "        \"value\": \"fr-tellière\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"FR COURONNE ECRITURE\",\n",
      "        \"value\": \"fr-couronne-écriture\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"FR COURONNE EDITION\",\n",
      "        \"value\": \"fr-couronne-édition\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"FR RAISIN\",\n",
      "        \"value\": \"fr-raisin\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"FR CARRE\",\n",
      "        \"value\": \"fr-carré\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"FR JESUS\",\n",
      "        \"value\": \"fr-jésus\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK BRIEF\",\n",
      "        \"value\": \"uk-brief\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK DRAFT\",\n",
      "        \"value\": \"uk-draft\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK FOOLSCAP\",\n",
      "        \"value\": \"uk-foolscap\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK QUARTO\",\n",
      "        \"value\": \"uk-quarto\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK CROWN\",\n",
      "        \"value\": \"uk-crown\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK BOOK A\",\n",
      "        \"value\": \"uk-book-a\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"UK BOOK B\",\n",
      "        \"value\": \"uk-book-b\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US LETTER\",\n",
      "        \"value\": \"us-letter\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US LEGAL\",\n",
      "        \"value\": \"us-legal\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US TABLOID\",\n",
      "        \"value\": \"us-tabloid\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US EXECUTIVE\",\n",
      "        \"value\": \"us-executive\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US FOOLSCAP FOLIO\",\n",
      "        \"value\": \"us-foolscap-folio\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US STATEMENT\",\n",
      "        \"value\": \"us-statement\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US LEDGER\",\n",
      "        \"value\": \"us-ledger\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US OFICIO\",\n",
      "        \"value\": \"us-oficio\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US GOV LETTER\",\n",
      "        \"value\": \"us-gov-letter\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US GOV LEGAL\",\n",
      "        \"value\": \"us-gov-legal\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US BUSINESS CARD\",\n",
      "        \"value\": \"us-business-card\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US DIGEST\",\n",
      "        \"value\": \"us-digest\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"US TRADE\",\n",
      "        \"value\": \"us-trade\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"NEWSPAPER COMPACT\",\n",
      "        \"value\": \"newspaper-compact\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"NEWSPAPER BERLINER\",\n",
      "        \"value\": \"newspaper-berliner\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"NEWSPAPER BROADSHEET\",\n",
      "        \"value\": \"newspaper-broadsheet\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"PRESENTATION 16 9\",\n",
      "        \"value\": \"presentation-16-9\"\n",
      "    },\n",
      "    {\n",
      "        \"label\": \"PRESENTATION 4 3\",\n",
      "        \"value\": \"presentation-4-3\"\n",
      "    }\n",
      "]\n"
     ]
    }
   ],
   "source": [
    "# Taken from typst-library/src/layout/page.rs\n",
    "pages = \"\"\"\n",
    "// ---------------------------------------------------------------------- //\n",
    "// ISO 216 A Series\n",
    "(A0:  841.0, 1189.0, \"a0\")\n",
    "(A1:  594.0,  841.0, \"a1\")\n",
    "(A2:  420.0,  594.0, \"a2\")\n",
    "(A3:  297.0,  420.0, \"a3\")\n",
    "(A4:  210.0,  297.0, \"a4\")\n",
    "(A5:  148.0,  210.0, \"a5\")\n",
    "(A6:  105.0,  148.0, \"a6\")\n",
    "(A7:   74.0,  105.0, \"a7\")\n",
    "(A8:   52.0,   74.0, \"a8\")\n",
    "(A9:   37.0,   52.0, \"a9\")\n",
    "(A10:  26.0,   37.0, \"a10\")\n",
    "(A11:  18.0,   26.0, \"a11\")\n",
    "\n",
    "// ISO 216 B Series\n",
    "(ISO_B1: 707.0, 1000.0, \"iso-b1\")\n",
    "(ISO_B2: 500.0,  707.0,  \"iso-b2\")\n",
    "(ISO_B3: 353.0,  500.0,  \"iso-b3\")\n",
    "(ISO_B4: 250.0,  353.0,  \"iso-b4\")\n",
    "(ISO_B5: 176.0,  250.0,  \"iso-b5\")\n",
    "(ISO_B6: 125.0,  176.0,  \"iso-b6\")\n",
    "(ISO_B7:  88.0,  125.0,  \"iso-b7\")\n",
    "(ISO_B8:  62.0,   88.0,  \"iso-b8\")\n",
    "\n",
    "// ISO 216 C Series\n",
    "(ISO_C3: 324.0, 458.0, \"iso-c3\")\n",
    "(ISO_C4: 229.0, 324.0, \"iso-c4\")\n",
    "(ISO_C5: 162.0, 229.0, \"iso-c5\")\n",
    "(ISO_C6: 114.0, 162.0, \"iso-c6\")\n",
    "(ISO_C7:  81.0, 114.0, \"iso-c7\")\n",
    "(ISO_C8:  57.0,  81.0, \"iso-c8\")\n",
    "\n",
    "// DIN D Series (extension to ISO)\n",
    "(DIN_D3: 272.0, 385.0, \"din-d3\")\n",
    "(DIN_D4: 192.0, 272.0, \"din-d4\")\n",
    "(DIN_D5: 136.0, 192.0, \"din-d5\")\n",
    "(DIN_D6:  96.0, 136.0, \"din-d6\")\n",
    "(DIN_D7:  68.0,  96.0, \"din-d7\")\n",
    "(DIN_D8:  48.0,  68.0, \"din-d8\")\n",
    "\n",
    "// SIS (used in academia)\n",
    "(SIS_G5: 169.0, 239.0, \"sis-g5\")\n",
    "(SIS_E5: 115.0, 220.0, \"sis-e5\")\n",
    "\n",
    "// ANSI Extensions\n",
    "(ANSI_A: 216.0,  279.0, \"ansi-a\")\n",
    "(ANSI_B: 279.0,  432.0, \"ansi-b\")\n",
    "(ANSI_C: 432.0,  559.0, \"ansi-c\")\n",
    "(ANSI_D: 559.0,  864.0, \"ansi-d\")\n",
    "(ANSI_E: 864.0, 1118.0, \"ansi-e\")\n",
    "\n",
    "// ANSI Architectural Paper\n",
    "(ARCH_A:  229.0,  305.0, \"arch-a\")\n",
    "(ARCH_B:  305.0,  457.0, \"arch-b\")\n",
    "(ARCH_C:  457.0,  610.0, \"arch-c\")\n",
    "(ARCH_D:  610.0,  914.0, \"arch-d\")\n",
    "(ARCH_E1: 762.0, 1067.0, \"arch-e1\")\n",
    "(ARCH_E:  914.0, 1219.0, \"arch-e\")\n",
    "\n",
    "// JIS B Series\n",
    "(JIS_B0:  1030.0, 1456.0, \"jis-b0\")\n",
    "(JIS_B1:   728.0, 1030.0, \"jis-b1\")\n",
    "(JIS_B2:   515.0,  728.0, \"jis-b2\")\n",
    "(JIS_B3:   364.0,  515.0, \"jis-b3\")\n",
    "(JIS_B4:   257.0,  364.0, \"jis-b4\")\n",
    "(JIS_B5:   182.0,  257.0, \"jis-b5\")\n",
    "(JIS_B6:   128.0,  182.0, \"jis-b6\")\n",
    "(JIS_B7:    91.0,  128.0, \"jis-b7\")\n",
    "(JIS_B8:    64.0,   91.0, \"jis-b8\")\n",
    "(JIS_B9:    45.0,   64.0, \"jis-b9\")\n",
    "(JIS_B10:   32.0,   45.0, \"jis-b10\")\n",
    "(JIS_B11:   22.0,   32.0, \"jis-b11\")\n",
    "\n",
    "// SAC D Series\n",
    "(SAC_D0: 764.0, 1064.0, \"sac-d0\")\n",
    "(SAC_D1: 532.0,  760.0, \"sac-d1\")\n",
    "(SAC_D2: 380.0,  528.0, \"sac-d2\")\n",
    "(SAC_D3: 264.0,  376.0, \"sac-d3\")\n",
    "(SAC_D4: 188.0,  260.0, \"sac-d4\")\n",
    "(SAC_D5: 130.0,  184.0, \"sac-d5\")\n",
    "(SAC_D6:  92.0,  126.0, \"sac-d6\")\n",
    "\n",
    "// ISO 7810 ID\n",
    "(ISO_ID_1: 85.6, 53.98, \"iso-id-1\")\n",
    "(ISO_ID_2: 74.0, 105.0, \"iso-id-2\")\n",
    "(ISO_ID_3: 88.0, 125.0, \"iso-id-3\")\n",
    "\n",
    "// ---------------------------------------------------------------------- //\n",
    "// Asia\n",
    "(ASIA_F4: 210.0, 330.0, \"asia-f4\")\n",
    "\n",
    "// Japan\n",
    "(JP_SHIROKU_BAN_4: 264.0, 379.0, \"jp-shiroku-ban-4\")\n",
    "(JP_SHIROKU_BAN_5: 189.0, 262.0, \"jp-shiroku-ban-5\")\n",
    "(JP_SHIROKU_BAN_6: 127.0, 188.0, \"jp-shiroku-ban-6\")\n",
    "(JP_KIKU_4:        227.0, 306.0, \"jp-kiku-4\")\n",
    "(JP_KIKU_5:        151.0, 227.0, \"jp-kiku-5\")\n",
    "(JP_BUSINESS_CARD:  91.0,  55.0, \"jp-business-card\")\n",
    "\n",
    "// China\n",
    "(CN_BUSINESS_CARD: 90.0, 54.0, \"cn-business-card\")\n",
    "\n",
    "// Europe\n",
    "(EU_BUSINESS_CARD: 85.0, 55.0, \"eu-business-card\")\n",
    "\n",
    "// French Traditional (AFNOR)\n",
    "(FR_TELLIERE:          340.0, 440.0, \"fr-tellière\")\n",
    "(FR_COURONNE_ECRITURE: 360.0, 460.0, \"fr-couronne-écriture\")\n",
    "(FR_COURONNE_EDITION:  370.0, 470.0, \"fr-couronne-édition\")\n",
    "(FR_RAISIN:            500.0, 650.0, \"fr-raisin\")\n",
    "(FR_CARRE:             450.0, 560.0, \"fr-carré\")\n",
    "(FR_JESUS:             560.0, 760.0, \"fr-jésus\")\n",
    "\n",
    "// United Kingdom Imperial\n",
    "(UK_BRIEF:    406.4, 342.9, \"uk-brief\")\n",
    "(UK_DRAFT:    254.0, 406.4, \"uk-draft\")\n",
    "(UK_FOOLSCAP: 203.2, 330.2, \"uk-foolscap\")\n",
    "(UK_QUARTO:   203.2, 254.0, \"uk-quarto\")\n",
    "(UK_CROWN:    508.0, 381.0, \"uk-crown\")\n",
    "(UK_BOOK_A:   111.0, 178.0, \"uk-book-a\")\n",
    "(UK_BOOK_B:   129.0, 198.0, \"uk-book-b\")\n",
    "\n",
    "// Unites States\n",
    "(US_LETTER:         215.9,  279.4, \"us-letter\")\n",
    "(US_LEGAL:          215.9,  355.6, \"us-legal\")\n",
    "(US_TABLOID:        279.4,  431.8, \"us-tabloid\")\n",
    "(US_EXECUTIVE:      84.15,  266.7, \"us-executive\")\n",
    "(US_FOOLSCAP_FOLIO: 215.9,  342.9, \"us-foolscap-folio\")\n",
    "(US_STATEMENT:      139.7,  215.9, \"us-statement\")\n",
    "(US_LEDGER:         431.8,  279.4, \"us-ledger\")\n",
    "(US_OFICIO:         215.9, 340.36, \"us-oficio\")\n",
    "(US_GOV_LETTER:     203.2,  266.7, \"us-gov-letter\")\n",
    "(US_GOV_LEGAL:      215.9,  330.2, \"us-gov-legal\")\n",
    "(US_BUSINESS_CARD:   88.9,   50.8, \"us-business-card\")\n",
    "(US_DIGEST:         139.7,  215.9, \"us-digest\")\n",
    "(US_TRADE:          152.4,  228.6, \"us-trade\")\n",
    "\n",
    "// ---------------------------------------------------------------------- //\n",
    "// Other\n",
    "(NEWSPAPER_COMPACT:    280.0,    430.0, \"newspaper-compact\")\n",
    "(NEWSPAPER_BERLINER:   315.0,    470.0, \"newspaper-berliner\")\n",
    "(NEWSPAPER_BROADSHEET: 381.0,    578.0, \"newspaper-broadsheet\")\n",
    "(PRESENTATION_16_9:    297.0, 167.0625, \"presentation-16-9\")\n",
    "(PRESENTATION_4_3:     280.0,    210.0, \"presentation-4-3\")\n",
    "\"\"\".strip()\n",
    "\n",
    "print(json.dumps([{\"label\": line.split(\":\")[0][1:].replace(\"_\", \" \"), \"value\": line.split('\"')[1]} for line in pages.split(\"\\n\") if line.startswith(\"(\")], indent=4, ensure_ascii=False))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
